package dk.modified.radioonlineapp;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.view.View;

public class NetworkChangeReceiver extends BroadcastReceiver {
	//private static android.net.NetworkInfo networkInfo = null;
	
	@Override
	public void onReceive(Context context, Intent intent) {

		if (MainActivity.isRadioServiceRunning(context)) {
			//Toast.makeText(context, "OK", Toast.LENGTH_SHORT).show();
			context.stopService(MainActivity.playerService);
			MainActivity.playerService = new Intent(context, RadioService.class);
			context.startService(MainActivity.playerService);
	
			MainActivity.anim.start();
			MainActivity.imgLoading.setVisibility(View.VISIBLE);
			

		}
		
		/*final ConnectivityManager connMgr = (ConnectivityManager) 
	    context.getSystemService(Context.CONNECTIVITY_SERVICE);

	    final android.net.NetworkInfo wifi = 
	    connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

	    final android.net.NetworkInfo mobile = 
	    connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
	
		if (wifi.isAvailable()) {

	    }
	    
	    if (mobile.isAvailable()) {
	    
	    }*/
			
	}
	
}
